<?php

namespace apiend\modules\user\models;

use Yii;
use yii\data\ActiveDataProvider;

/**
 * 用户中心查询
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class UserCenterSearch extends \common\models\user\User {

    /**
     * @inheritdoc
     */
    public function fields() {
        return [
            'id',
            'nickname' => 'username',
            'mobile' => function() {
                if ($this->mobile) {
                    return $this->decryptMobile();
                }
                return '';
            },
            'avatar' => function() {
                return Url::attach($this->avatar);
            },
            'cover' => function() {
                return Url::attach($this->cover);
            },
            'gender',
            'location',
            'rongyun_token' => 'rongCloudToken',
            'signature',
            'birthday',
            'register_time' => 'created_at',
        ];
    }

}
